package cn.jmu;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

public class mathExamTest {
	static String topicNum ;
	static String gradeNum ;
@Before
	public void setUp() throws Exception {
         mathExam.result = 0;
    }

	@Test
	public void testAddNum() {
		mathExam.setNummber(2, 3);
		assertEquals(5,mathExam.addNum());
	}

	@Test
	public void testSubNum() {
		mathExam.setNummber(10, 12);
		assertEquals(2, mathExam.subNum());
	}

	@Test
	public void testMulNum() {
		mathExam.setNummber(2, 5);
		assertEquals(10, mathExam.mulNum());
	}

	@Test
	public void testDivNum() {
		mathExam.setNummber(45, 9);
		assertEquals(5, mathExam.divNum());
	}

	@Test
	public void testRemNum() {
		mathExam.setNummber(45, 9);
		assertEquals(0, mathExam.remNum());
	}

	@Test(expected = IllegalArgumentException.class)
	public void testTopicCondition() {
		String[] str = mathExam.getParameter();
		topicNum = str[0];
		gradeNum = str[1];
		mathExam.topicCondition(topicNum, gradeNum);
	}

}
